-
Notifications
You must be signed in to change notification settings - Fork 1.8k
clippy_dev
: Parsing revamp part 2/N
#15921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
rustbot has assigned @samueltardieu. Use |
clippy_dev/src/deprecate_lint.rs
Outdated
pub fn deprecate(clippy_version: Version, name: &str, reason: &str) { | ||
let mut lints = find_lint_decls(); | ||
let (mut deprecated_lints, renamed_lints) = read_deprecated_lints(); | ||
pub fn deprecate<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, name: &'env str, reason: &'env str) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of those lifetimes are necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are overly complicated. Just 'cx
would be enough.
clippy_dev/src/parse.rs
Outdated
impl ParseCxImpl { | ||
/// Finds all lint declarations (`declare_clippy_lint!`) | ||
#[must_use] | ||
pub fn find_lint_decls(&mut self) -> Vec<Lint> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: It is strange that in this commit &mut self
is used as a parameter and never used. This would not pass dogfood should the PR be partially merged up to this commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is about the first commit? Github doesn't present any information about what commit you add a comment to, unfortunately.
The commit sets up the interface changes needed to use the context. Not taking self
would change that. unused_self
shouldn't even lint on ZSTs since they don't actually contain anything, but their mere existence can still mean something.
clippy_dev/src/parse.rs
Outdated
} | ||
|
||
#[must_use] | ||
pub fn read_deprecated_lints(&mut self) -> (Vec<DeprecatedLint>, Vec<RenamedLint>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same nit as above about &mut self
@rustbot label -S-blocked |
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Based on #15866
This adds a parsing context that can allocate from an arena. Ultimately this will also store a source map for better error reporting, but a few other changes are happening before that.
The arena itself is unlikely to be needed from a perf standpoint (reading all the files should be the slow part), but having more things be copyable is nice. For reference the perf impact of this change is within the noise.
changelog: none